package com.gfxy.educational.service;

import com.gfxy.commons.utils.UUIDUtil;
import com.gfxy.educational.dao.EduClassMapper;
import com.gfxy.educational.dao.EduCommonMapper;
import com.gfxy.educational.entity.EduClass;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * @author: lijixin 2019-06-06
 */
@Service
public class ClassService {

    private static final Logger logger = LoggerFactory.getLogger(ClassService.class);

    @Autowired
    private EduCommonMapper commonMapper;

    @Autowired
    private EduClassMapper classMapper;

    public List<Map> getClassViewInfoByCollegeAndGrade(String collegeId, String gradeId) {
        return commonMapper.getClassViewInfoByCollegeAndGrade(collegeId,gradeId);
    }


    public List<Map> getClassViewInfoByCollege(String collegeId) {
        return commonMapper.getClassViewInfoByCollege(collegeId);
    }

    public int deleteClassInfoById(String classId) {

        return classMapper.deleteByPrimaryKey(classId);
    }

    public int insertClassInfo(EduClass eduClass){
        eduClass.setClassId(UUIDUtil.getUUID());
        return classMapper.insert(eduClass);
    }

    public int updateClassInfo(EduClass eduClass){
        return classMapper.updateByPrimaryKeySelective(eduClass);
    }
}
